package com.oazon.common.util;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.text.Html;
import android.text.Spanned;

import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;

public class VolleyUtil {

	public static Request<String> getRequest(int method, String url,
			Response.ErrorListener errorListener,
			final Response.Listener<String> linListener, final String decode) {
		Request<String> request = new Request<String>(method, url,
				errorListener) {

			@Override
			protected Response<String> parseNetworkResponse(
					NetworkResponse response) {
				String parsed = "";
				try {
					parsed = new String(response.data, decode);
				} catch (UnsupportedEncodingException e) {
					e.printStackTrace();
				}
				return Response.success(parsed,
						HttpHeaderParser.parseCacheHeaders(response));
			}

			@Override
			protected void deliverResponse(String arg0) {
				linListener.onResponse(arg0);
			}
		};

		return request;
	}
}
